import os,sys
osa = os.path.abspath
osd = os.path.dirname
cur_dir = osd(osa(__file__))
par_dir = osd(cur_dir)
# par_dir = get_par_dir()
sys.path.insert(0,par_dir)

import json
from utils.util_for_os import osj,ose

data_dir = '/mnt/nas/shengjie/datasets/dataset_depth_control_depth/'
save_path = 'data_restore_depth_150.json'

names_path = osj( data_dir , 'names.txt' )

assert ose( data_dir ),data_dir

with open(names_path,encoding='utf-8') as f:
    names = f.readlines()
    
will_save = {'data':[]}

from tqdm import tqdm
for name in tqdm(names):
    name = name.strip()
    if not name.endswith('.jpg'):continue
    
    img_path = osj( data_dir , name )
    
    will_save['data'].append( {
        'captions':'[Erase the Depth Content]',
        'img_path':img_path,
    } )


with open( save_path , 'w' , encoding='utf-8' ) as f:
    json.dump( will_save , f , indent=2 , ensure_ascii=False )